program c;

{$APPTYPE CONSOLE}

var
  sa: array[1..47] of String;
  sc: String;
  i, n, j: byte;
begin
  readln(n);
  for i := 1 to n do
    readln(sa[i]);
  readln(sc);
  for i := 1 to n do
    if '[ ] ' + sc = sa[i] then
      writeln('[/] ' + sc)
    else
      writeln(sa[i]);
end.
